<?php
$oJobs = JobHandler::getJobs();
$oJob = $oJobs[$_SESSION['iJobID']];
$sMissiongroups = $oJob->getMissiongroups();

$iCurrentYear = date('Y');
$iCurrentMonth = date('m');
$iCurrentDay = date('d');

$iNow = mktime();
$iEndTime = mktime(17);
?>
<div id="layer_job_makereport" class="hidden" style="visibility: visible;">
<form action="index.php" method="post" name="form_job_makereport">
<input type="hidden" name="sView" value="job-report">
<input type="hidden" name="iJobID" value="<?php print $_SESSION['iJobID'] ?>">
<table class="boxborder" cellspacing="0">
	<tr>
		<td class="boxhandle" colspan="2"><?php print msg('Report') ?></td>
	</tr>
	<tr>
		<td class="fieldname"><?php print msg('Project') ?>:</td>
		<td class="fieldvalue"><?php print $oJob->sName ?></td>
	</tr>
	<tr>
		<td class="fieldname"><?php print msg('From') ?>:</td>
		<td class="fieldvalue">
			<table cellspacing="0">
				<tr>
					<td class="fieldvalue small center"><?php print msg('Year') ?></td>
					<td class="fieldvalue small center"><?php print msg('Month') ?></td>
					<td class="fieldvalue small center"><?php print msg('Day') ?></td>
				</tr>
				<tr>
					<td class="fieldvalue small center"><input type="text" name="iFromYear" size="4" value="<?php print $iCurrentYear ?>"></td>
					<td class="fieldvalue small center"><input type="text" name="iFromMonth" size="2" value="<?php print $iCurrentMonth ?>"></td>
					<td class="fieldvalue small center"><input type="text" name="iFromDay" size="2" value="01"></td>
				</tr>
				<tr>
					<td class="fieldvalue small" colspan="3">
						<?php print msg('Time') ?>:
						<input type="text" name="sFromTime" size="5" value="08:00">
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td class="fieldname"><?php print msg('To') ?>:</td>
		<td class="fieldvalue">
			<table cellspacing="0">
				<tr>
					<td class="fieldvalue small center"><?php print msg('Year') ?></td>
					<td class="fieldvalue small center"><?php print msg('Month') ?></td>
					<td class="fieldvalue small center"><?php print msg('Day') ?></td>
				</tr>
				<tr>
					<td class="fieldvalue small center"><input type="text" name="iToYear" size="4" value="<?php print $iCurrentYear ?>"></td>
					<td class="fieldvalue small center"><input type="text" name="iToMonth" size="2" value="<?php print $iCurrentMonth ?>"></td>
					<td class="fieldvalue small center"><input type="text" name="iToDay" size="2" value="<?php print $iCurrentDay ?>"></td>
				</tr>
				<tr>
					<td class="fieldvalue small" colspan="3">
						<?php print msg('Time') ?>:
						<input type="text" name="sToTime" size="5" value="<?php print ($iEndTime < $iNow ? date('H:i') : '17:00') ?>">
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td class="fieldname"><?php print msg('Verbose') ?>:</td>
		<td class="fieldvalue">
			<input type="checkbox" onClick="document.form_job_makereport.sView.value = (this.checked ? 'job-report_verbose' : 'job-report');">
		</td>
	</tr>
<?php
foreach ($sMissiongroups as $iMissiongroup => $sThisMissiongroup) {
	?>
	<tr>
		<td class="separator" colspan="2">
			<input type="checkbox" name="bMissiongroups[]" value="<?php print $iMissiongroup ?>" checked>
			<?php print $sThisMissiongroup ?>
		</td>
	</tr>
	<?php
}
?>
	<tr>
		<td class="boxbody center" colspan="2">
			<input type="submit" value="<?php print msg('Create report') ?>">
			<input type="button" value="<?php print msg('Cancel') ?>" onClick="layerHide('layer_job_makereport');">
		</td>
	</tr>
</table>
</form>
</div>

